using UnityEngine;
using System.Collections;

public class Escola : MonoBehaviour
{
    GameObject g;
    private int Id = 10;

    AudioSource audio_s;
    AudioClip audio_c;

    void Start()
    {
        SceneManager.scene = "Escola";

        g = new GameObject("B_Avancar", typeof(B_Avancar));
        g.GetComponent<B_Avancar>();
        g.tag = "B_Avancar";

        g = new GameObject("Caio", typeof(Caio));
        g.GetComponent<Caio>();
        g.tag = "Caio";

        /*g = new GameObject("Richard", typeof(Richard));
        g.GetComponent<Richard>();
        g.tag = "Richard";*/

        this.gameObject.AddComponent("MeshRenderer");
        this.gameObject.AddComponent("MeshFilter");
        this.gameObject.AddComponent("BoxCollider");
        audio_s = (AudioSource)gameObject.AddComponent("AudioSource");
        audio_c = (AudioClip)Resources.Load("Sounds/AmbienteEscola");

        audio_s.clip = audio_c;
        audio_s.loop = true;
        audio_s.Play();

        this.transform.position = new Vector3(0, 0, 0);
        Mesh mesh = Quad.Create(1.5f, 1);

        this.gameObject.GetComponent<MeshFilter>().mesh = mesh;
        this.gameObject.GetComponent<MeshRenderer>().material = AtlasManager.globalMaterial;
        this.gameObject.GetComponent<MeshFilter>().mesh.uv = new Vector2[]
		{
			new Vector2(AtlasManager.rects[Id].xMin, AtlasManager.rects[Id].yMax),
			new Vector2(AtlasManager.rects[Id].xMax, AtlasManager.rects[Id].yMax),
			new Vector2(AtlasManager.rects[Id].xMax, AtlasManager.rects[Id].yMin),
			new Vector2(AtlasManager.rects[Id].xMin, AtlasManager.rects[Id].yMin)
		};
    }

    void Update()
    {
        
    }
}
